home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: cs.vu.nl!jalten
- From: jalten@cs.vu.nl (Alten JP)
- Subject: Re: Why can't I use this function prototype????
- Nntp-Posting-Host: kits.cs.vu.nl
- References: <60ju5934@kbrady.ultranet.com>
- Sender: news@cs.vu.nl
- Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
- Date: Wed, 10 Jan 1996 15:11:33 GMT
- X-Newsreader: TIN [version 1.2 PL2]
- Message-ID: <DKz0v9.2Lr.0.-s@cs.vu.nl>
-
- Ken Brady (kbrady@ultranet.com) wrote:
- : I have a header file with something like:
- :
- : /* pm_app.hpp */
- : Class PmApplication {
- ^^^^^
- class PmApplication {
-
- : PmApplication();
- : .... //member and method definitions here
- : };
- :
- : PmApplication *Application(); //a typical function prototype??
- : // other function prototypes here
- : // end pm_app.hpp
- :
- : My implementation is, of course, hidden from users of the header file:
- :
- : /* pm_app.cpp */
- : PmApplication *App=NULL; //a global variable
- :
- : PmApplication *Application() {return App;}
-
- Might want to change this to read:
-
- PmApplication *Application() {
- if (App) return App;
- static far PmApplication staticApp;
- return &staticApp;
- }
- just if you wish, a PmApplication will be created if App equals NULL
-
-
- : PmApplication::PmApplication()
- : { App = this;}
-
- : ... // more implementations
- :
-
- :
- : So, I try to use this function:
- :
- : /* myapp.cpp */
- : #include "pm_app.hpp"
- :
- : void MyProcedure()
- : { ...
- : PmApp *A=Application(); //won't compile!!
- ^^^^^
- PmApplication* A = Application(); // compiles fine under Borland
- : ...
- : }
- :
-
- Which compiler do you use? Is there a conflict with Application()
- and any other (library-) functions or classes?
- Try changing Application() to HeyThisIsMyApplication() see
- what happens...
-
- Good Luck
-
- Jelle Paul
-
-
- --
- +-------------------------------------------------------+
- | Jelle Paul Alten | jalten@cs.vu.nl |
- | Vrije Universiteit Amsterdam | |
- +-------------------------------------------------------+
-